<template>
  <!-- 一级目录组件 -->
  <div class="asiseMenu">
      <el-menu>
      <el-menu-item index="1">
        <template slot="title">
          <i class="el-icon-s-operation"></i>
            <router-link to="/mainzy/projectInfo">项目信息</router-link>
        </template>
       </el-menu-item>
      <!-- 基础数据 -->
      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-s-home"></i>
          <span>基础数据</span>
        </template>
        <el-menu-item-group>
          <router-link to="/mainzy/basicData/basicDataUnit"><el-menu-item index="2-1">
            <i class="el-icon-set-up"></i>单位配置</el-menu-item></router-link>
          <router-link to="/mainzy/basicData/fluid"><el-menu-item index="2-2">
            <i class="el-icon-light-rain"></i>流体</el-menu-item></router-link>
          <router-link to="/mainzy/basicData/basicDataPipe"><el-menu-item index="2-3">
            <i class="el-icon-coin"></i>管材与设备</el-menu-item></router-link>
<!--          <router-link to="/mainzy/basicData/basicDataFacility"><el-menu-item index="2-4">设备</el-menu-item></router-link>-->
<!--           <el-menu-item index="2-5">其他</el-menu-item>-->
        </el-menu-item-group>
      </el-submenu>
      <!-- 模型检查 -->
     <el-submenu index="3" >
      <template slot="title">
        <i class="el-icon-aim"></i>
        <span>模型检查</span>
      </template>
      <el-menu-item-group>
        <router-link to="/mainzy/validityCheck/basicData1"><el-menu-item index="3-1">管网列表</el-menu-item></router-link>
        <router-link to="/mainzy/validityCheck"><el-menu-item index="3-2">管网拓补结构</el-menu-item></router-link>
      </el-menu-item-group>
      </el-submenu >
        <el-menu-item index="4" >
          <template slot="title">
            <i class="el-icon-notebook-1"></i>
            <span>
              <router-link to="/mainzy/steady">稳态计算</router-link>
            </span>
          </template>
       </el-menu-item>
       <el-menu-item index="5">
          <template slot="title">
            <i class="el-icon-notebook-2"></i>
            <span>
              <router-link to="/mainzy/transient">瞬态计算</router-link>
            </span>
          </template>
       </el-menu-item>
       <el-menu-item index="6">
          <template slot="title">
            <i class="el-icon-takeaway-box"></i>
            <span>
              <router-link to="/">计算结果</router-link>
            </span>
          </template>
       </el-menu-item>
    </el-menu>
  </div>
</template>
<script>
import { mapState } from "vuex";
export default {
  name: "myMenu",
  data() {
    return {
      /*ifDisabled:this.$store.state.pageStatus.pageStatus,*/
      user:JSON.parse(window.sessionStorage.getItem("user")) //将保存在sessionStorage里面的数据根据key值取出来
    };
  },
  methods: {
    logout(){
      this.$confirm('此操作将注销登录, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.getRequest("/api/logout"); /*确认退出后，获取后端的数据*/
        window.sessionStorage.removeItem("user") /*删除登录用户的缓存数据*/
        this.$store.commit('initRoutes',[]) /*删除登录用户的缓存数据*/
        this.$router.replace("/") /*退出后回到登录页*/
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消操作'
        });
      });
    },
     inFluid() {
      this.$router.push({
        name: "fluidList",
        params: {
          projectName: this.name,
          id: this.id,
        },
      });
    },
     inPipeStructure() {
      this.$router.push({
        name: "basicData1",
        params: {
          projectName: this.name,
          id: this.id,
        },
      });
     },
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
  },
  computed: {
    ...mapState("projectList", ["projectName", "projectId"]),
    name() {
      return this.projectName;
    },
    id() {
      return this.projectId;
    },
  },
};
</script>
<style  scoped>
.asideTop {
  display: inline-flex;
  width: 70px;
  height: 60px;
  border: 1px solid black;
  margin: 10px 5px 10px 15px;
  /* margin: 10px auto; */
}

.headerBtns {
  width: 160px;
  margin: 10px 15px;
  color: #000;
  /* margin: 10px auto; */
}

/* 底部 */
.asideButtom {
  height: 40px;
  margin: 50px 0px 10px 15px;
}
.username {
  width: 90px;
}
.quit {
  width: 50px;
}
</style>
